public class PieceFactory{
    private HashMap Piecepool=new HashMap();
    public APiece GetPiece(String key){
        if(!PiecePool.containsKey(key)){
            APiece p=new OnePiece(key);
            PiecePool.put(key,p);
            return p;
        }
        return (APiece)PiecePool.get(key);
    }
    public int GetPieceCont(){
        return PiecePool.size();
    }
}